<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.mycompany.tools.Page,com.mycompany.stock.dto.Stock" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'list.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    This is my JSP page. <br>
    <%=request.getAttribute("stockType") %>
    
   <table width="90%" borer=1 align="center">
   	<%
   		Page pages =(Page) request.getAttribute("page");
   		if(pages.getResultList()!=null && pages.getResultList().size()>1){
   			Stock stock = null;
   			for(int i =0;i<pages.getResultList().size();i++){
   				stock = (Stock)pages.getResultList().get(i);
   				out.println("<tr>");
 
   				out.println("<td>股票代码:\t"+stock.getStockCode()+"</td>");
   				out.println("<td>股票名称:\t"+stock.getStockName()+"</td>");
   				out.println("<td>最新价格:\t"+stock.getPrices()+"</td>");
   				out.println("<td>最近涨幅:\t"+stock.getStockRose()+"</td>");
   				out.println("<td>所属行业:\t"+stock.getStockType()+"</td>");
   				out.println("</tr>");
   				
   				out.println("<tr><td colspan='5'>每股收益:\t"+stock.getEarningsPerShare()+"</td></tr>");
   				out.println("<tr><td colspan='5'>每股公积金:\t"+stock.getEpsAccumulationFund()+"</td></tr>");
   				out.println("<tr><td colspan='5'>每股未分配利润:\t"+stock.getEpsUndistributedProfit()+"</td></tr>");
   				out.println("<tr><td colspan='5'>主营产品:\t"+stock.getMainProducts()+"</td></tr>");
   				out.println("<tr><td colspan='5'>主营利润:\t"+stock.getMainProfits()+"</td></tr>");
   				
   				out.println("<tr><td colspan='5'>--------------------------------------------------------------------</td></tr>");
   			
   			}
   		}
   		
   		out.println("<tr><td colspan='5' aling='right'>");
   		out.println("<a href='/stockList?currentPage=1'>"+"第一页</a>&nbsp;");
   		if(pages.getCurrentPage() != 0){
   			out.println("<a href='stockList?currentPage="+(pages.getCurrentPage()-1)+"'>"+"上一页</a>&nbsp;");
   		}
   		if(pages.getCurrentPage() < pages.getTotalPage()){
   			out.println("<a href='stockList?currentPage="+(pages.getCurrentPage()+1)+"'>"+"下一页</a>&nbsp;");
   		}
   		out.println("<a href='stockList?currentPage="+pages.getTotalPage()+"'>"+"末页</a>&nbsp;");
   		
   		out.println("</td></tr>");
   	 %>
   	<tr>
   
   </table>
   
  </body>
</html>
